﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace ArmyCreator.ViewModels
{
    public class OptionViewModel : ALoadable<DataModel.Option>, INotifyPropertyChanged
    {

        private string name;

        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                NotifyPropertyChanged("Name");
            }
        }

        private int nb;

        public int Nb
        {
            get { return nb; }
            set
            {
                nb = value;
                NotifyPropertyChanged("Nb");
            }
        }

        private int points;

        public int Points
        {
            get { return points; }
            set
            {
                points = value;
                NotifyPropertyChanged("Points");
            }
        }


        #region NOTIFICATIONS
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion

        protected override void Load(DataModel.Option model, int depth)
        {
            this.Nb = model.Count;
            this.Name = model.Name;
            this.Points = 0;
        }
    }
}
